/*
 * 
 * 
 * 
 */
package com.hboxs.asl.entity;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import javax.persistence.*;
import java.math.BigDecimal;
import java.util.*;

/**
 * Entity - 认证
 */
@Entity
@Table(name = "xx_member_certification")
@SequenceGenerator(name = "sequenceGenerator", sequenceName = "xx_member_certification_sequence")
public class MemberCertification extends BaseEntity {

    private static final long serialVersionUID = 1533130686721725835L;


    /**
     * 认证类型
     */
    public enum CerType {

        //个人
        person,

        //机构
        company;

        private static Map<String, MemberCertification.CerType> map = new HashMap<>();

        static {
            map.put("老师认证", person);
            map.put("机构认证", company);
        }

        @JsonCreator
        public static MemberCertification.CerType forValue(String value) {
            return map.get(value);
        }

        @JsonValue
        public String toValue() {
            for (Map.Entry<String, MemberCertification.CerType> entry : map.entrySet()) {
                if (entry.getValue() == this) {
                    return entry.getKey();
                }
            }

            return "";
        }
    }


    /**
     * 性别
     */
    public enum Gender {

        /**
         * 男
         */
        male,

        /**
         * 女
         */
        female;

        private static Map<String, MemberCertification.Gender> map = new HashMap<>();

        static {
            map.put("男", male);
            map.put("女", female);
        }

        @JsonCreator
        public static MemberCertification.Gender forValue(String value) {
            return map.get(value);
        }

        @JsonValue
        public String toValue() {
            for (Map.Entry<String, MemberCertification.Gender> entry : map.entrySet()) {
                if (entry.getValue() == this) {
                    return entry.getKey();
                }
            }

            return "";
        }
    }

    /**
     * 性别
     */
    private Gender gender;

    /**
     * 认证类型
     */
    private CerType cerType;

    /**
     * 名称
     */
    private String relName;

    /**
     * 微信名
     */
    private String wechatName;

    /**
     * 身份证
     */
    private String idCard;

    /**
     * 联系地址
     */
    private String relAddress;

    /**
     * 手机号码
     */
    private String relPhone;

    /**
     * 邮箱
     */
    private String email;

    /**
     * 专长
     */
    private String speciality;

    /**
     * 派别
     */
    private String faction;

    /**
     * 用户
     */
    private Member member;

    /**
     * 回答提问金额（风水）
     */
    private BigDecimal payFengshui;

    /**
     * 回答提问金额（婚恋感情）
     */
    private BigDecimal payGanqing;

    /**
     * 回答提问金额（事业财运）
     */
    private BigDecimal payShiye;

    /**
     * 回答提问金额（其他）
     */
    private BigDecimal payOther;

    /**
     * 联系电话
     */
    private String tel;

    /**
     * 资格证书
     */
    private List<String> qualificationImages = new ArrayList<>();

    /**
     * 机构证件
     */
    private List<String> agencyImages = new ArrayList<>();

    /**
     * 状态
     */
    public enum Status {

        /**
         * 审核中
         */
        reviewing,

        /**
         * 通过
         */
        passed,

        /**
         * 拒绝
         */
        reject;

        private static Map<String, Status> map = new HashMap<>();

        static {
            map.put("审核中", reviewing);
            map.put("通过", passed);
            map.put("拒绝", reject);
        }

        public static Status forValue(String value) {
            return map.get(value);
        }

        @JsonValue
        public String toValue() {
            for (Map.Entry<String, Status> entry : map.entrySet()) {
                if (entry.getValue() == this) {
                    return entry.getKey();
                }
            }

            return "";
        }

        public static Status getDefault() {
            return Status.reviewing;
        }
    }

    /**
     * 状态
     */
    private Status status;

    public Status getStatus() {
        return status;
    }

    public void setStatus(Status status) {
        this.status = status;
    }

    public String getRelName() {
        return relName;
    }

    public void setRelName(String relName) {
        this.relName = relName;
    }

    public String getIdCard() {
        return idCard;
    }

    public void setIdCard(String idCard) {
        this.idCard = idCard;
    }

    public String getRelAddress() {
        return relAddress;
    }

    public void setRelAddress(String relAddress) {
        this.relAddress = relAddress;
    }

    public String getRelPhone() {
        return relPhone;
    }

    public void setRelPhone(String relPhone) {
        this.relPhone = relPhone;
    }

    @JoinColumn(name = "member",unique = true)
    @OneToOne(fetch = FetchType.LAZY)
    public Member getMember() {
        return member;
    }

    public void setMember(Member member) {
        this.member = member;
    }

    public CerType getCerType() {
        return cerType;
    }

    public void setCerType(CerType cerType) {
        this.cerType = cerType;
    }

    public String getWechatName() {
        return wechatName;
    }

    public void setWechatName(String wechatName) {
        this.wechatName = wechatName;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getSpeciality() {
        return speciality;
    }

    public void setSpeciality(String speciality) {
        this.speciality = speciality;
    }

    public String getFaction() {
        return faction;
    }

    public void setFaction(String faction) {
        this.faction = faction;
    }

    /**
     * 获取性别
     *
     * @return 性别
     */
    public MemberCertification.Gender getGender() {
        return gender;
    }

    /**
     * 设置性别
     *
     * @param gender 性别
     */
    public void setGender(MemberCertification.Gender gender) {
        this.gender = gender;
    }

    public BigDecimal getPayFengshui() {
        return payFengshui;
    }

    public void setPayFengshui(BigDecimal payFengshui) {
        this.payFengshui = payFengshui;
    }

    public BigDecimal getPayGanqing() {
        return payGanqing;
    }

    public void setPayGanqing(BigDecimal payGanqing) {
        this.payGanqing = payGanqing;
    }

    public BigDecimal getPayShiye() {
        return payShiye;
    }

    public void setPayShiye(BigDecimal payShiye) {
        this.payShiye = payShiye;
    }

    public BigDecimal getPayOther() {
        return payOther;
    }

    public void setPayOther(BigDecimal payOther) {
        this.payOther = payOther;
    }

    public String getTel() {
        return tel;
    }

    public void setTel(String tel) {
        this.tel = tel;
    }

    @ElementCollection
    @CollectionTable(name = "xx_member_qualification_image")
    public List<String> getQualificationImages() {
        return qualificationImages;
    }

    public void setQualificationImages(List<String> qualificationImages) {
        this.qualificationImages = qualificationImages;
    }

    @ElementCollection
    @CollectionTable(name = "xx_member_agency_image")
    public List<String> getAgencyImages() {
        return agencyImages;
    }

    public void setAgencyImages(List<String> agencyImages) {
        this.agencyImages = agencyImages;
    }

    @Override
    public String toString() {
        return "MemberCertification{" +
                "gender=" + gender +
                ", cerType=" + cerType +
                ", relName='" + relName + '\'' +
                ", wechatName='" + wechatName + '\'' +
                ", idCard='" + idCard + '\'' +
                ", relAddress='" + relAddress + '\'' +
                ", relPhone='" + relPhone + '\'' +
                ", email='" + email + '\'' +
                ", speciality='" + speciality + '\'' +
                ", faction='" + faction + '\'' +
                ", member=" + member +
                ", payFengshui=" + payFengshui +
                ", payGanqing=" + payGanqing +
                ", payShiye=" + payShiye +
                ", payOther=" + payOther +
                ", tel='" + tel + '\'' +
                ", qualificationImages=" + qualificationImages +
                ", agencyImages=" + agencyImages +
                ", status=" + status +
                '}';
    }
}